#pragma once

#include "Foundation.h"
#include "Room.h"


class Price {
public:
				Price(string file);
				~Price();

				// Returning if possible the price for that day
	int 		getPrice(Date date, Room::RoomType type);		
	
private:
	/* Private struct Interval
	 * Defines price variations in a defined interval
	 */
	struct Interval : public Element {
		Date 	start;
		Date 	end;
		int 	week[3];
		int 	weekend[3];
		
		Interval() {
			week[0] = week[1] = week[2] = 0;
			weekend[0] = weekend[1] = weekend[2] = 0;
		}
	};
	
	int 		stdWeek[3];
	int 		stdWeekend[3];
	List		*intervals;
	
	/* Methods for determining the price */
	int 		defaultPrice(Date date, Room::RoomType type);
	int 		specialPrice(Date date, Room::RoomType type);
	
	/* Methods for reading from file */
	void 		readStandard(ifstream &file);
	void 		readInterval(ifstream &file, Date start, Date end, int num);
	void 		readSinglePrice(ifstream &file, int prices[3]);
	void 		readSinglePrice(ifstream &file, Interval *interval);
	
	bool		isWeekend(Date date);
};
